<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="tfn" uri="http://www.totoro.com/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>评价管理 - 是！龙猫</title>
    <link rel="shortcut icon" type="image/x-icon" href="/static/img/index/favicon.png">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/public.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/nav.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/iconFont/iconfont.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/user/my_comment.css"/>
</head>
<style>
    .page *,table *{
        font-size: 12px;
    }
</style>
<body>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/frame/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/frame/totoro-utils.js"></script>
<script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>
<jsp:include page="${pageContext.request.contextPath}/public_page/nav.jsp"></jsp:include>
<div style="width: 100%; height: 6px; background-color: #F2F2F2"></div>

<jsp:include page="${pageContext.request.contextPath}/public_page/ui_header.jsp"></jsp:include>

<!-- content start-->
<div id="page">
    <div id="content">
    <div class="grid-c2">
        <div class="col-main">
            <div class="main-wrap">
                <ul style="height: 34px;" class="tb-rate-nav-tabs level-1" data-spm="1998471780">
                    <li class="active">我的评价</li>
                </ul>


                <div id="new-rate-content">
                    <div class="clearfix personal-info">		<div class="tb-rate-box this-is-personal">
                        <div class="box-hd">个人信息</div>
                        <div class="box-bd">
                            <dl class="clearfix">
                                <dt>会员名：</dt>
                                <dd>${user.userName}</dd>
                                <dt>阿里旺旺：</dt>
                                <dd><span class="ww-light ww-large" data-nick="ansen16195">
                                    <a target="_blank" class="ww-inline" title="点此可以直接和卖家交流选好的宝贝，或相互交流网购体验，还支持语音视频噢。"></a></span></dd>
                                <dt>站内信：</dt>
                                <dd><a href="//member1.taobao.com/message/add_private_msg.htm?recipient_nickname=ansen16195">发送信件</a></dd>
                                <dt>地址：${user.redstarText}</dt>
                                <dd> &nbsp; </dd>
                                <dt class="title">认证信息：</dt>
                                <dd>
                                    <a href="//cshall.alipay.com/hall/index.htm?sceneCode=PC_MY_ACCOUNT&amp;problemId=77" target="_blank">
                                        <img alt="支付宝个人认证" border="0" align="absmiddle" src="//img.alicdn.com/zfb_person_small.gif" title="支付宝个人认证">
                                    </a>


                                </dd>
                            </dl>
                            <ul class="faq J-show-anywhere">
                                <li><a href="//service.taobao.com/support/help-10061.htm" target="_blank" title="店铺评分是怎么打分的，有没有标准的？">店铺评分是怎么打分的...</a></li>
                                <li><a href="//service.taobao.com/support/help-4162.htm" target="_blank" title="淘宝网评价规则">淘宝网评价规则</a></li>
                                <li><a href="//service.taobao.com/support/help-10060.htm" target="_blank" title="评价如何修改和删除">评价如何修改和删除</a></li>
                                <li><a href="//service.taobao.com/support/help-10062.htm" target="_blank" title="“炒作信用”如何处罚">“炒作信用”如何处罚</a></li>
                                <li><a href="//service.taobao.com/support/help-569.htm" target="_blank" title="被差评怎么办？">被差评怎么办？</a></li>
                                <li><a href="//service.taobao.com/support/knowledge-1121789.htm" target="_blank" title="手机上评价的步骤">手机上评价的步骤</a></li>
                            </ul>
                        </div>
                    </div>
                        <div class="personal-rating" data-spm="a1z0b.3.5920761" data-spm-max-idx="2">
                            <!--uri: /myRate.vm type: pageNoCache -->

                            <h4 class="tb-rate-ico-bg ico-shop J-show-anywhere" data-tbrate-anywhere="123"><a data-spm-protocol="i" data-spm="d4910301" href="//service.taobao.com/support/help-16482.htm" target="_blank" data-spm-anchor-id="a1z0b.3.5920761.d4910301">店铺半年内动态评分</a></h4>
                            <table class="seller-rate-info">
                                <colgroup>
                                    <col class="text">
                                    <col class="graph">
                                </colgroup>
                                <tbody>
                                <%-- 计算所有关于出售的积分 --%>
                                <c:forEach items="${statisticsList}" var="productComment" varStatus="vs">
                                    <c:set var="babyScore" value="${babyScore+productComment.commentBabyStar}"></c:set>
                                    <c:set var="sellerScore" value="${sellerScore+productComment.commentSellerStar}"></c:set>
                                    <c:set var="logisticsScore" value="${logisticsScore+productComment.commentLogisticsStar}"></c:set>
                                </c:forEach>
                                <c:set var="babyAvg" value="${tfn:formatNumber(babyScore / fn:length(statisticsList), 1)}"></c:set>
                                <c:set var="sellerAvg" value="${tfn:formatNumber(sellerScore / fn:length(statisticsList), 1)}"></c:set>
                                <c:set var="logisticsAvg" value="${tfn:formatNumber(logisticsScore / fn:length(statisticsList), 1)}"></c:set>
                                <tr>
                                    <td class="text">
                                        <span class="title">宝贝与描述相符</span>
                                        <div>
                                            <span>
                                               <div id="babyStar"></div>
                                            </span>
                                            <span>
                                                <br>
                                                ${babyAvg == 'NaN'?'暂时无人打分':babyAvg+='分'}
											</span>
                                        </div>
                                    </td>
                                    <td class="graph">
                                        <div class="scroller">
                                            <p>
                                                <span class="c-value-0">
                                                    <em>${babyAvg}</em>
                                                </span>
                                            </p>
                                        </div>
                                    </td>
                                </tr>

                                <tr>
                                    <td class="text">
                                        <span class="title">卖家的服务态度</span>
                                        <div>
                                            <span>
                                                <div id="sellerStar"></div>
                                            </span>
                                            <span>
                                                <br>
                                                ${sellerAvg == 'NaN'?'暂时无人打分':sellerAvg+='分'}
											</span>
                                        </div>
                                    </td>
                                    <td class="graph">
                                        <div class="scroller">
                                            <p>
                                                <span class="c-value-0">
                                                    <em>${sellerAvg}</em>
                                                </span>
                                            </p>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text">
                                        <span class="title">物流服务的质量</span>
                                        <div>
                                            <span>
                                                <div id="logisticsStar"></div>
                                            </span>
                                            <span>
												<br>
                                                ${logisticsAvg == 'NaN'?'暂时无人打分':logisticsAvg+='分'}
											</span>
                                        </div>
                                    </td>
                                    <td class="graph">
                                        <div class="scroller">
                                            <p>
                                                <span class="c-value-0">
                                                    <em>${logisticsAvg}</em>
                                                </span>
                                            </p>
                                        </div>
                                    </td>
                                </tr>
                                <script>
                                    layui.use(['rate'], function() {
                                        var rate = layui.rate;
                                        rate.render({
                                            elem: '#babyStar'
                                            ,value: ${babyAvg=='NaN'?0:babyAvg}
                                            ,half: true
                                            ,readonly: true
                                        })

                                        rate.render({
                                            elem: '#sellerStar'
                                            ,value: ${sellerAvg=='NaN'?0:sellerAvg}
                                            ,half: true
                                            ,readonly: true
                                        })

                                        rate.render({
                                            elem: '#logisticsStar'
                                            ,value: ${logisticsAvg=='NaN'?0:logisticsAvg}
                                            ,half: true
                                            ,readonly: true
                                        })
                                    });
                                </script>
                                <style>
                                    .layui-rate {
                                         padding: 0;
                                        font-size: 0;
                                    }
                                    .layui-rate li i.layui-icon {
                                        font-size: 10px;
                                         margin-right: 0px;
                                    }
                                </style>


                                <tr>
                                    <td colspan="2" class="desc">
                                        <div>
                                            <ul>
                                                <li>1分<br>非常不满</li>
                                                <li>2分<br>不满意</li>
                                                <li>3分<br>一般</li>
                                                <li>4分<br>满意</li>
                                                <li style="width: 60px;">5分<br>非常满意</li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                                </tbody>
                            </table>


                            <h4 class="tb-rate-ico-bg ico-buyer" data-tbrate-anywhere="124" style="color:black">买家信誉评分</h4>
                            <table class="seller-rate-info" style="border-collapse: separate; border-spacing: 10px;" data-spm-anchor-id="a1z0b.3.5920761.i3.6ffb1d909qhywt">
                                <tbody><tr class="text">
                                    <td data-spm-anchor-id="a1z0b.3.5920761.i2.6ffb1d909qhywt">买家信誉分：${user.credibilityScore} 分
                                        <!-- 信誉分等级对应图标 -->
                                        <c:forEach begin="1" end="${user.creditLevel.imgCount}">
                                            <img src="${user.creditLevel.levelImg}" style="height:14px;" border="0" align="absmiddle" class="rank">
                                        </c:forEach>
                                    </td>
                                </tr>
                                <tr class="text"><td>您是${tfn:creditScoreToCharacter(user.credibilityScore)}${user.creditLevel.imgCount}级用户，信誉优秀~</td></tr>
                                <tr class="text"><td data-spm-anchor-id="a1z0b.3.5920761.i1.6ffb1d909qhywt"><a href="//service.taobao.com/support/knowledge-847752.htm?spm=a1z0b.3.5920761.2.6ffb1d909qhywt" target="_blank" data-spm-anchor-id="a1z0b.3.5920761.2">信誉分规则介绍</a></td></tr>
                                </tbody></table>


                        </div>
                    </div>


                    <div class="rate-list" id="rateList" data-spm="a1z0b.3.5920813">
                        <ul class="tb-rate-nav-tabs level-2">
                            <li ${param.findType==1?'class="active"':''}><a href="/user/myComment.htm?findType=1">来自买家的评价</a></li>
                            <li ${param.findType==2?'class="active"':''}><a href="/user/myComment.htm?findType=2">来自卖家的评价</a></li>
                            <li ${param.findType==3 or empty param.findType?'class="active"':''} data-tbrate-anywhere="127"><a href="/user/myComment.htm?findType=3">给他人的评价</a></li>
                            <li ${param.findType==4?'class="active"':''}><a href="/user/myComment.htm?findType=4">已处理的评价</a><sup class="new">新</sup></li>
                        </ul>

                        <script>
                            function doDelete(e) {
                                var name = e.target.id.replace(/button/,'form');
                                var	form = document.getElementsByName(name)[0];
                                if (confirm("亲，评价一旦删除将无法恢复且无法追加评价。\n确定要删除吗？")) {
                                    form.submit();
                                }
                            }
                        </script>

                        <table id="J_RateList" class="tb-rate-table thm-list tb-rate-table-rates">
                            <colgroup>
                                <col class="rate">
                                <col class="content">
                                <col class="who">
                                <col class="what">
                                <col class="op">
                            </colgroup>
                            <thead>
                            <tr>
                                <th class="align-c">
                                    <select class="evaType">
                                        <option ${empty param.showType or param.showType==9999?'selected="selected"':''} value="9999">评价</option>
                                        <option ${param.showType==1?'selected="selected"':''} value="1">好评</option>
                                        <option ${param.showType==0?'selected="selected"':''} value="0">中评</option>
                                        <option ${param.showType==-1?'selected="selected"':''} value="-1">差评</option>
                                    </select>
                                </th>
                                <th>
                                    <select class="evaContent">
                                        <option ${empty param.showContent or param.showContent==9999?'selected="selected"':''} value="9999">评论</option>
                                        <option ${param.showContent==1?'selected="selected"':''} value="1">有评论内容</option>
                                        <option ${param.showContent==0?'selected="selected"':''} value="0">无评论内容</option>
                                    </select>
                                </th>
                                <th>
                                    ${param.findType==1 or param.findType==4?'评价人':'被评价人'}
                                </th>
                                <th>宝贝信息</th>
                                <th class="align-c">操作</th>
                            </tr>
                            </thead>
                            <tbody>

                            <c:if test="${fn:length(productComments) <= 0}" var="isEmpty">
                                <p>暂无记录</p>
                            </c:if>
                            <c:if test="${!isEmpty}">
                                <c:forEach items="${productComments}" var="productComment" varStatus="vs">
                                    <tr class="J_RateItem feedback-${productComment.id}" data-id="${productComment.id}">
                                        <td class="align-c">
                                            <i class="tb-rate-ico ico-good" title="${productComment.commentScore == 1?'好评':productComment.commentScore==-1?'差评':'不评价'}" ${productComment.commentScore==-1?'style="background-position:0 0px"':productComment.commentScore==0?'style="background-position: 0 -49px"':''}></i>
                                            <p>
                                            <span class="bracket">[
                                                <a href="//knowledge.taobao.com/support/seller/knowledge-1125162.htm" target="_blank" ${productComment.commentScore==-1?'style="color:red"':''}>${productComment.commentScore == 0?'不计分':productComment.commentScore == 1?'加一分':'减一分'}</a>]</span></p>
                                        </td>
                                        <td class="J_ReviewContent">



                                            <p class="comment">
                                                <c:if test="${productComment.commentText == 'totoro yyds'}" var="isDefault">
                                                    评价方未及时做出评价,系统默认好评!
                                                </c:if>
                                                <c:if test="${!isDefault}">
                                                    <span class="bracket">[<a href="//mall.taobao.com" target="_blank">来自天猫</a>]</span>
                                                    ${param.findType==2?productComment.sellerReply.text:'整体评价：'+=productComment.commentText}
                                                </c:if>
                                            </p>
                                            <c:if test="${productComment.isHaveImage == 1 && param.findType!=2}">
                                                <ul class="photos" style="overflow:hidden;">
                                                    <c:forEach items="${productComment.commentImageList}" var="image" varStatus="vs2">
                                                        <li data-img-id="${image.id}">
                                                            <a href="${image.imagePath}" target="_blank">
                                                                <img src="${image.imagePath}" style="width: 40px; height: 40px;">
                                                            </a>
                                                            <c:if test="${param.findType != 4 && param.findType!=1}">
                                                                <button type="button" class="eva-img" data-cfg="{&quot;fileId&quot;:&quot;1098507127050186270&quot;,&quot;rateId&quot;:&quot;1132949028922&quot;,&quot;sellerId&quot;:&quot;303557818&quot;,&quot;buyerId&quot;:&quot;3574779617&quot;,&quot;_tb_token_&quot;:&quot;f0f956eaeee3e&quot;}">×</button>
                                                            </c:if>
                                                        </li>
                                                    </c:forEach>
                                                </ul>
                                            </c:if>
                                            <p class="date">[${param.findType==2?productComment.sellerReply.createTime:productComment.createTime}]</p>
                                            <c:if test="${productComment.marketSrOrder.isAppendComment == 1 && param.findType!=2}">
                                                <div class="append" data-append-id="${productComment.appendComment.id}">
                                                    <c:set var="day" value="${tfn:timeDifferenceDay(productComment.receiptDate, productComment.appendComment.createTime)}"></c:set>
                                                    <p class="comment">
                                                        <span class="bracket">[追加评论]</span> ${productComment.appendComment.text}
                                                    </p>
                                                    <c:if test="${productComment.appendComment.isHaveImage == 1 && param.findType!=2}">
                                                        <ul class="photos" style="overflow:hidden;">
                                                            <c:forEach items="${productComment.appendComment.acImages}" var="image" varStatus="vs2">
                                                                <li data-img-id="${image.id}">
                                                                    <a href="${image.acImagePath}" target="_blank">
                                                                        <img src="${image.acImagePath}" style="width: 40px; height: 40px;">
                                                                    </a>
                                                                    <c:if test="${param.findType != 4 && param.findType!=1}">
                                                                        <button type="button" class="append-eva-img" data-cfg="{&quot;fileId&quot;:&quot;1098507127050186270&quot;,&quot;rateId&quot;:&quot;1132949028922&quot;,&quot;sellerId&quot;:&quot;303557818&quot;,&quot;buyerId&quot;:&quot;3574779617&quot;,&quot;_tb_token_&quot;:&quot;f0f956eaeee3e&quot;}">×</button>
                                                                    </c:if>
                                                                </li>
                                                            </c:forEach>
                                                        </ul>
                                                    </c:if>
                                                    <p class="date">${day=="0"?"收货当天追加：":"确认收货 "+=day+=" 天追加评论"}</p>
                                                </div>
                                            </c:if>
                                            <c:if test="${(param.findType == 4 or param.findType == 1) and productComment.marketSrOrder.sellerIsReply == 1}">
                                                <div class="reply">
                                                    <p class="comment">
                                                        <span class="bracket" style="color: #f40">[卖家解释]</span> ${productComment.sellerReply.text}
                                                    </p>
                                                    <p class="date">[${productComment.sellerReply.createTime}]</p>
                                                </div>
                                            </c:if>
                                        </td>
                                        <td>
                                            ${param.findType==1 or param.findType==4?"买家：":"商家："}
                                            <c:if test="${param.findType == 1 or param.findType == 4}" var="isSeller">
                                                <a href="#">${productComment.user.userName}</a>
                                                <c:set var="credit" value="${tfn:creditScoreToCreditLevel(productComment.user.credibilityScore)}"></c:set>
                                            </c:if>
                                                <c:if test="${!isSeller}">
                                            <a href="/shop/view_shop.htm?brandId=${productComment.user.shop.id}" target="_blank">${productComment.user.shop.shopName}</a>
                                                    <img style="padding-top:4px;vertical-align: text-bottom;" src="//assets.alicdn.com/sys/common/icon/trade/order_mall.png">
                                                    <c:set var="credit" value="${tfn:creditScoreToCreditLevel(productComment.user.shop.starScore)}"></c:set>
                                                </c:if>
                                                <c:forEach begin="1" end="${credit.imgCount}">
                                                    <img src="${credit.levelImg}"/>
                                                </c:forEach>


                                        </td>
                                        <td>

                                            <a href="/buy.htm?pid=${productComment.marketSrOrder.product.id}&skuCode=0" title="${productComment.marketSrOrder.product.productName}" target="_blank">${productComment.marketSrOrder.product.productName}</a>
                                            <p class="price"><em><fmt:formatNumber value="${productComment.marketSrOrder.product.productSpecs.productPrice}" type="currency" pattern=".0"/></em>元</p>
                                        </td>
                                        <td class="J_RateListOp align-c op">


                                            <form name="anonyform">
                                                <input type="hidden" name="_tb_token_" value="f0f956eaeee3e">
                                                <input type="hidden" name="rate_id" value="1137784553410">
                                                <input type="hidden" name="action" value="rate_action">
                                                <input type="hidden" name="ratedUserNumId" value="2115622532">
                                                <input type="hidden" name="event_submit_do_anony" value="anything">
                                                <c:if test="${param.findType == 3 and productComment.isAnOnyMouse == 0}">
                                                    <button type="button" class="tb-rate-btn type-secondary size-xs anonymous">匿名评价</button>
                                                </c:if>
                                                <c:if test="${param.findType == 1 and productComment.marketSrOrder.sellerIsReply == 0}">
                                                    <button type="button" class="J_Reply tb-rate-btn type-taobao size-xs reply-button">回复</button>
                                                </c:if>
                                            </form>

                                            <div class="compaint-content"></div>

                                            <div class="main-complaint-result">
                                                <p></p>
                                            </div>

                                            <div class="append-result">
                                                <p></p>
                                            </div>

                                        </td>
                                    </tr>
                                </c:forEach>
                            </c:if>
                            </tbody>
                        </table>
                        <div class="tb-rate-pagination theme-1 align-r">

                        </div>
                        <div style="display:none;" class="tb_video_pop" id="J_VideoPop">
                            <div class="tb_video_pop_mask" id="J_VideoPlayerMask"></div>
                            <div class="tb_video_pop_content" id="J_VideoPlayerContent"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- left -->
        <jsp:include page="${pageContext.request.contextPath}/public_page/ui-left.jsp"></jsp:include>
        <style>
            #myRate a{
                color: #f40;
            }
        </style>
    </div>
    </div>
</div>
<!-- content end-->

<jsp:include page="${pageContext.request.contextPath}/public_page/last.html"></jsp:include>
<jsp:include page="/public_page/open_chat.jsp"></jsp:include>

<div id="ks-component120" class="ks-dialog ks-overlay reply-dialog" tabindex="0" role="dialog"style="width: 643px; left: 646.5px; top: 1025.5px; display: none;">
    <a href="javascript:void('close')" id="ks-overlay-close-ks-component120" class="ks-dialog-close ks-overlay-close close-reply" role="button">
        <span class="ks-dialog-close-x ks-overlay-close-x">close</span>
    </a>


    <div id="ks-content-ks-component120" class="ks-dialog-content ks-overlay-content">
        <div class="ks-dialog-header ks-overlay-header" style="" id="ks-stdmod-header-ks-component120"></div>
        <div class="ks-dialog-body ks-overlay-body" style=" " id="ks-stdmod-body-ks-component120">
            <div id="reply-overlay" style="">
            <div class="form-body">
                <textarea class="text-reply" maxlength="500" name="reply"></textarea>
                <div class="count-indicator">500字</div>
            </div>
            <div class="form-foot clearfix">
                <button type="button" class="J_submit tb-rate-btn type-taobao size-s submit-reply" style="float: right;">发表回复</button>
                <span class="tb-rate-alert type-warn">回复信息泄露买家隐私和信息将受到<a target="_blank" href="//a.taobao.com/detail/2011/01/18/437614/1.php">淘宝处罚</a></span>
                <div class="J_err msg" style="display:none;"></div>
            </div>
            <b class="reply-arrow"></b>
            <b class="reply-arrow2"></b>
        </div></div>
        <div class="ks-dialog-footer ks-overlay-footer" style="" id="ks-stdmod-footer-ks-component120"></div>
    </div>
    <div tabindex="0"></div></div>
<script>
    // 用户保存卖家选择回复的单条评论
    var $evaEl = jQuery;
    $(function () {
        $(".evaType").change(function () {
            var newUrl = Totoro.changeURLPar(Totoro.deleteURLPar(window.location.href, "showType"), "showType", $(this).val());
            window.history.pushState(null,null,newUrl);//向当前url添加参数
            window.location.href = window.location.href;
        });
        $(".evaContent").change(function () {
            var newUrl = Totoro.changeURLPar(Totoro.deleteURLPar(window.location.href, "showContent"), "showContent", $(this).val());
            window.history.pushState(null,null,newUrl);//向当前url添加参数
            window.location.href = window.location.href;
        });

        // 匿名评价
        $(".anonymous").click(function () {
            var pcId = $(this).parents(".J_RateItem").attr("data-id");
            var fg = confirm("您确定要匿名评价吗？");
            let _this = $(this);
            if(fg!=null){
                $.post("/evaluation/updateAnonymous.htm", {"pcId":pcId}, function (res) {
                    if(res == "success"){
                        _this.remove();
                    } else{
                        alert("系统繁忙，请稍后再试");
                    }

                });
            }
        });

        // 删除普通评论图片
        $(".eva-img").click(function () {
            // 获取评论id，图片id
            var pcId = $(this).parents(".J_RateItem").attr("data-id");
            var imageId = $(this).parent().attr("data-img-id");
            var fg = confirm("你确定要删除这张图片吗？");
            let _this = $(this);
            if(fg != null){
                $.post("/evaluation/deleteImage.htm", {"pcId": pcId, "ciId": imageId}, function (res) {
                    if(res == "success"){
                        _this.parent().remove();
                    } else{
                        alert("系统繁忙，请稍后再试");
                    }
                })
            }
        });

        // 删除追评图片
        $(".append-eva-img").click(function () {
            // 获取评论id，追评id，追评图片id
            var pcId = $(this).parents(".J_RateItem").attr("data-id");
            var acId = $(this).parents(".append").attr("data-append-id");
            var imageId = $(this).parent().attr("data-img-id");
            var fg = confirm("你确定要删除这张图片吗？");
            let _this = $(this);
            if(fg != null){
                $.post("/evaluation/deleteAppendImage.htm", {"pcId": pcId, "acId": acId, "aciId": imageId}, function (res) {
                    if(res == "success"){
                        _this.parent().remove();
                    } else{
                        alert("系统繁忙，请稍后再试");
                    }
                })
            }
        })

        // 回复
        $(".reply-button").click(function () {
            // 如果点击的回复跟上一个已经点击的回复是同一条评论，则进行关闭操作，而且不删除之前填写过的内容
            if($evaEl.length == 1 && $evaEl.attr("data-id") == $(this).parents(".J_RateItem").attr("data-id")){
                var displayStatus = $("#ks-component120").css("display");
                if(displayStatus == "block"){
                $("#ks-component120").slideUp(400);
                } else{
                    $("#ks-component120").slideDown(400);
                }
                return false;
            }
            // 清除之前的文本内容
            $(".text-reply").val("");
            $("#ks-component120").hide();
            // 将位置改成当前回复评价的下面
            var $parentEl = $(this).parents(".J_RateItem");
            $evaEl = $parentEl;
            var $x = $parentEl.offset().left;
            var $y = $parentEl.offset().top;
            var $height = $parentEl.height();
            $("#ks-component120").css({"top":parseInt($y)+parseInt($height)+"px","left":parseInt($x)+86+"px"});
            $("#ks-component120").slideDown(400);
        });

        // 点击发表回复
        $(".submit-reply").click(function () {
            // 获取评论id
            var pcId = $evaEl.attr("data-id");
            // 获取回复文本域
            var $replyContent = $(".text-reply");
            // 必须输入回复内容
            if($replyContent.val().length < 1){
                $replyContent.addClass("arrow_box").attr("placeholder","请输入回复内容！");
                return false;
            }
            $("#ks-component120").slideUp(400);

            var date = new Date();
            var year = date.getFullYear();        //年 ,从 Date 对象以四位数字返回年份
            var month = date.getMonth() + 1;      //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
            var day = date.getDate();             //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
            var hours = date.getHours();          //小时 ,返回 Date 对象的小时 (0 ~ 23)
            var minutes = date.getMinutes();      //分钟 ,返回 Date 对象的分钟 (0 ~ 59)
            var seconds = date.getSeconds();      //秒 ,返回 Date 对象的秒数 (0 ~ 59)
            var currentFormatDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;

            $evaEl.find(".J_ReviewContent").append("<div class='reply'>\n" +
                "<p class='comment'>\n" +
                "<span class='bracket' style='color: #f40'>[卖家解释]</span> "+$replyContent.val()+"\n" +
                "</p>\n" +
                "<p class='date'>["+currentFormatDate+"]</p>\n" +
                "</div>");
            $evaEl.find(".reply-button").remove();
            $.ajaxSettings.async = false;
            $.post("/evaluation/sr_evaluation.htm", {"pcId":pcId, "text":$replyContent.val()}, function (data) {
                layui.use('layer', function(){
                    var layer = layui.layer;
                    layer.msg('回复成功', {offset: "300px"});
                });
            });

        });

        // 进入焦点关闭回复文本域呼吸灯
        $(".text-reply").focus(function () {
            $(this).removeClass("arrow_box").attr("placeholder","");
        });

        // 关闭回复框
        $(".close-reply").click(function () {
            $("#ks-component120").slideUp(400);
        });

        // 输入回复框里的字，改变可输入字数量
        $(".text-reply").keyup(function () {
            $(".count-indicator").text(500-parseInt($(this).val().length)+"字");
        })

        // 缩小，不移动回复框的位置
        $(window).resize(function() {
            // 如果用户选择了回复
            if($evaEl.length == 1){
                var $x = $evaEl.offset().left;
                $("#ks-component120").css({"left":parseInt($x)+85+"px"});
            }
        })
    })
</script>
</body>
</html>
